package abstractEntities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import org.hibernate.annotations.GenericGenerator;

import entities.Course;
import entities.Departament;
import entities.Student;
import entities.User;

/**
 * AbstractMastercoach entity provides the base persistence definition of the
 * Mastercoach entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractMastercoach implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -7028580430357949594L;
	private Integer idMaster;
	private Departament departament;
	private User user;
	private Integer date;
	private Integer points;
	private Set<Student> students = new HashSet<Student>(0);
	private Set<Course> courses = new HashSet<Course>(0);

	// Constructors

	/** default constructor */
	public AbstractMastercoach() {
	}

	/** minimal constructor */
	public AbstractMastercoach(Departament departament, User user,
			Integer date, Integer points) {
		this.departament = departament;
		this.user = user;
		this.date = date;
		this.points = points;
	}

	/** full constructor */
	public AbstractMastercoach(Departament departament, User user,
			Integer date, Integer points, Set<Student> students,
			Set<Course> courses) {
		this.departament = departament;
		this.user = user;
		this.date = date;
		this.points = points;
		this.students = students;
		this.courses = courses;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idMaster", unique = true, nullable = false)
	public Integer getIdMaster() {
		return this.idMaster;
	}

	public void setIdMaster(Integer idMaster) {
		this.idMaster = idMaster;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idDepartament", nullable = false)
	public Departament getDepartament() {
		return this.departament;
	}

	public void setDepartament(Departament departament) {
		this.departament = departament;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idUser", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "date", nullable = false)
	public Integer getDate() {
		return this.date;
	}

	public void setDate(Integer date) {
		this.date = date;
	}

	@Column(name = "points", nullable = false)
	public Integer getPoints() {
		return this.points;
	}

	public void setPoints(Integer points) {
		this.points = points;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "mastercoach")
	public Set<Student> getStudents() {
		return this.students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "mastercoach")
	public Set<Course> getCourses() {
		return this.courses;
	}

	public void setCourses(Set<Course> courses) {
		this.courses = courses;
	}

}